package top.mcwebsite.lib.router.compose

import androidx.compose.runtime.Composable
import androidx.compose.runtime.DisposableEffect
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.ui.Modifier
import androidx.navigation.NavGraphBuilder
import androidx.navigation.NavHostController
import androidx.navigation.compose.NavHost
import androidx.navigation.compose.rememberNavController
import top.mcwebsite.lib.route.api.EasyRouter

@Composable
fun RouteContainer(
    startRoute: String,
    navController: NavHostController = rememberNavController(),
    modifier: Modifier,
) {
    LaunchedEffect(Unit) {
        EasyRouter.init(navController)
    }
    NavHost(
        navController = navController,
        startDestination = startRoute,
        builder = NavGraphBuilder::routeGraphBuilder,
        modifier = modifier
    )
}